package com.nondo.rdp.finance.service.impl.setting.home;

import com.nondo.rdp.finance.domain.setting.home.SettingModuleNotice;
import com.nondo.rdp.finance.repository.setting.home.SettingModuleNoticeRepository;
import com.nondo.rdp.finance.service.setting.home.SettingModuleNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class SettingModuleNoticeServiceImpl implements SettingModuleNoticeService {
    @Autowired
    SettingModuleNoticeRepository settingModuleNoticeRepository;

    @Override
    public SettingModuleNotice findOne(Long id) {
        return this.settingModuleNoticeRepository.findOne(id);
    }

    @Override
    public SettingModuleNotice save(SettingModuleNotice settingModuleNotice) {
        return this.settingModuleNoticeRepository.save(settingModuleNotice);
    }

    @Override
    public void update(SettingModuleNotice settingModuleNotice) {
        this.settingModuleNoticeRepository.save(settingModuleNotice);
    }

    @Override
    public void delete(Long id) {
        this.settingModuleNoticeRepository.deleteById(id);
    }

    @Override
    public List<SettingModuleNotice> findAll(Sort sort) {
        return this.settingModuleNoticeRepository.findAllByDelFlag("0", sort);
    }
}